import Vue from 'vue'
import VueRouter from "vue-router";


//  安装插件
Vue.use(VueRouter)

const  routes = [
    {
        path: '',
        redirect: '/home'
    },
    {
        path: "/home",
        name: 'home',
        component: () => import('@/views/home/Home')
    },
    {
        path: "/user",
        name: 'user',
        component: () => import('@/views/user/User')
    },
    {
        path: "/cart",
        name: 'cart',
        component: () => import('@/views/cart/Cart')
    },
    {
        path: "/list",
        name: 'list',
        component: () => import('@/views/category/Category')
    }

]


// 创建router
const router =  new VueRouter({
    routes,
    mode: 'history'
})


export default router
